package com.top10.controller;

import com.top10.bean.ResponseBean;
import com.top10.entity.Brand;
import com.top10.service.impl.BrandServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 品牌详细信息Controller
 */
@Controller
@RequestMapping("brand")
public class BrandController {

    @Autowired
    private BrandServiceImpl brandService;

    @RequestMapping(value = "/getbrand",method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean getBrand(String uuid)throws Exception{
        if(uuid == null){
            return ResponseBean.createError("输入的参数为空");
        }
        Brand brand=brandService.getBrand(uuid);
        if(brand == null){
            return ResponseBean.createError("不存在此品牌信息");
        }else{
            return ResponseBean.createSuccess().addData("brand",brand);
        }
    }

}
